######################################################################
#MarineShow.py
#
#Purpose:  Open and print the values in a Marine character sheet; mostly for 
#   game testing but can be modified for actual game play
#Author:  Cody Jackson
#Date:  7/3/06
#
#Copyright 2006 Cody Jackson
#This program is free software; you can redistribute it and/or modify it 
#under the terms of the GNU General Public License as published by the Free 
#Software Foundation; either version 2 of the License, or (at your option) 
#any later version.
#
#This program is distributed in the hope that it will be useful, but 
#WITHOUT ANY WARRANTY; without even the implied warranty of 
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
#General Public License for more details.
#
#You should have received a copy of the GNU General Public License 
#along with this program; if not, write to the Free Software Foundation, 
#Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#----------------------------------------------------------------------
#Version 0.1
#   Initial build
######################################################################

#!/usr/bin/env python
import cPickle

def openFile():
    """Get the name of a character file and open it."""
    
    charFile = raw_input("Enter the character file path to open:")
    fileOpen = open(charFile, "r")
    marine = cPickle.load(fileOpen)
    return marine

def printChar(marine):
    """Print the values in a character file."""
    
    print "\nName =", marine.name
    print "\nGender =", marine.gender
    print "\nAge =", marine.age
    print "\n"
    for key in marine.attrib_dict.keys():
        print key, marine.attrib_dict[key]
    print "\n"
    for key in marine.hp_dict.keys():
        print key, marine.hp_dict[key]    
    print "\nSkills"
    print marine.chosenSkills
    print "\nSubskills"
    print marine.subskills
    print "\nRank:", marine.rank
    print "\nRank name:", marine.rankName
    print "\nMOS:", marine.mos
    print "\nInitiative = ", marine.marineInit
    
def test():
    character = openFile()
    printChar(character)
    
if __name__ == "__main__":
    test()